#ifndef _DATABASE_H_
#define _DATABASE_H_

#include "head.h"
#include "touch_screen.h"
#include "character.h"
#include "eroll_reg.h"

void add_user_info(void);
void write_front_userinfo(void);
void add_user_reg(void);
bool judge_only_account(char *judge_account);
bool judge_login_info(char *account, char *code);
void reset_struct_info(void);
void printf_test(char *p, int len);
// 从文件中反初始化结构体
void set_struct_info(char *loginaccount, int account_size);
// 读取某一行的数据
int read_specified_line(const char *filename, int target_line, char *buffer, size_t buffer_size);
void set_struct_infohhhhhh(void);
// -------------------------- 结构体定义 --------------------------
typedef struct doctor_info
{
    char doctor_name[15];
    unsigned short doctor_age;
    char doctor_introduce[20];
    char appoint_time[20]; // 新增：预约时间（格式如“2025-10-16 09:30”）
    struct doctor_info *next_doctor;
} doctor_info_t;

// database.h 中的 department_info 结构体
typedef struct department_info
{
    char department_name[20];
    unsigned int doctor_num; // 已有：科室医生数量
    doctor_info_t *doctor;
    struct department_info *next_department;
} department_info_t;

//----------------------------------账号密码信息-----------
// database.h 中的 user_info 结构体定义
typedef struct user_info
{
    char sort[5];
    char account[12];
    char code[7];
    char user_name[15];
    unsigned short user_age;
    char user_idnum[19];
    unsigned int department_num;
    department_info_t *department;
    unsigned int money;
    struct user_info *next_user;
} user_info_t;
#endif